<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style12/Auxiliaryoutlinestyle2Bg.webp'})`,
      }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div
        class="content"
        :class="{
          content2:
            !props.info.value &&
            !props.info.remarks &&
            !(props.info.video && props.info.video.url) &&
            !props.info.subTitle,
          content3:
            !props.info.value &&
            !props.info.remarks &&
            !(props.info.video && props.info.video.url) &&
            props.info.subTitle,
        }"
      >
        <div class="img-parent">
          <div
            class="img-shadow"
            :style="{
              backgroundImage:
                (props.info.video && props.info.video.url) || props.info.value
                  ? `url(${publicUrls + 'free/style12/Auxiliaryoutlinestyle2Bgcover1.webp'})`
                  : `url(${publicUrls + 'free/style12/Auxiliaryoutlinestyle2Bgcover2.webp'})`,
            }"
          ></div>
          <div v-if="(props.info.video && props.info.video.url) || props.info.value" class="img-box">
            <videoview
              @click="audioplay(false)"
              :info="props.info"
              v-if="props.info.video && props.info.video.url"
            ></videoview>
            <div v-else class="outline-cover">
              <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
            </div>
          </div>
        </div>
        <div class="content-right">
          <div class="title-box">
            <img
              class="title-left"
              :src="publicUrls + 'free/style12/Auxiliaryoutlinestyletitle2Bg1.webp'"
              alt=""
            />
            <div
              class="title-content"
              :style="{
                backgroundImage: `url(${
                  publicUrls + 'free/style12/Auxiliaryoutlinestyletitle2Bg2.webp'
                })`,
              }"
            >
              <span>{{ props.info.text }}</span>
            </div>
            <img
              class="title-right"
              :src="publicUrls + 'free/style12/Auxiliaryoutlinestyletitle2Bg3.webp'"
              alt=""
            />
          </div>
          <p class="subtitle" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>

          <div class="remarks1" v-if="(props.info.video && props.info.video.url) || props.info.value">
            <TextMax
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="6"
            ></TextMax>
          </div>
          <div class="remarks2" :class="{ remarks3: !props.info.subTitle }" v-else-if="props.info.remarks">
            <TextMax
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="props.info.subTitle ? 6 : 6"
            ></TextMax>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>



<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax12.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
  indexs: {
    type: Number || String,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
  :deep(.van-text-ellipsis) {
    font-size: 16px !important;
    line-height: 28px !important;
  }
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 73px;
  width: 900px;
  height: 412px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 34% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.audio-parent {
  position: absolute;
  top: 0px;
  right: 429px;
  width: 79px;
  height: 74px;
}
.content { 
  position: relative;
  display: flex;
  width: 900px;
  height: 412px;
}
.content:hover {
  .img-shadow {
    animation: swing3 50s infinite ease-in-out;
  }
}

.content2 {
  // justify-content: center;
  .title-box {
  }
}
.content3 {
  // justify-content: center;
  .title-box {
  }
  .subtitle {
  }
}
.title-box {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  height: 44px;
  .title-left,
  .title-right {
    width: 27px;
    height: 44px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .title-content {
    display: flex;
    align-items: center;
    justify-content: center;
    background-repeat: repeat;
    background-size: 100% 100%;
    min-width: 160px;
    height: 44px;
    :deep(span) {
      font-family: Alimama DongFangDaKai;
      font-size: 20px;
      font-weight: 400;
      line-height: 24px;
      text-align: center;
      background: linear-gradient(90deg, #ffeabc 0%, #fec64b 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
  }
}
.content-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 375px;
  height: 288px;
  margin-top: 62px;
  margin-left: 27px;
}
.subtitle {
  width: 321px;
  font-family: PingFang SC;
  font-size: 16px;
  font-weight: 400;
  line-height: 28px;
  color: rgba(255, 227, 162, 1);
  text-align: center;
  margin-top: 10px;
}
.img-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 448px;
  height: 412px;
}
.img-shadow {
  position: absolute;
  top: -18px;
  left: 0px;
  width: 448px;
  height: 448px;
  background-repeat: no-repeat;
  background-size: 100% 100%;

  transform-origin: center center; /* 设置旋转中心为顶部中心 */
}
@keyframes swing3 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.img-box {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: 337px;
  height: 338px;
  border-radius: 50%;
  margin-top: -6px;
  :deep(video) {
    background: rgba(57, 56, 54, 0.1);
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}
.img-box:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
// .img-box1 {
//   height: 213px;
// }
// .img-box2 {
//   height: 243px;
// }
// .img-box3 {
//   height: 283px;
// }

.remarks1 {
  margin-top: 10px;
  width: 321px;
  :deep(.van-text-ellipsis) {
  }
}

.remarks2 {
  margin-top: 10px;
  width: 321px;
}
.remarks3 {
  width: 321px;
  margin-top: 20px;
}
:deep(.round) {
  border-color: #ffe3a2 !important;
  .freeIcon {
    color: #ffe3a2 !important;
  }
}
</style>
